/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jnetmonitor.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTabbedPane;

/**
 *
 * @author r1nlx0
 */
public class MainWindow extends JFrame {
    
    private JTabbedPane tabbedPane;
    private JMenuBar mainMenuBar;
    private JMenu fileMenu;
    private JMenu helpMenu;
    private JMenu viewMenu;
    
    
    public MainWindow() {
        initComponents();
    }
    
    private void initComponents() {
        tabbedPane = new JTabbedPane();
        tabbedPane.addTab("Sniffer", null, 
                new SnifferPanel(), "Sniffing panel tab.");
    
        mainMenuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        helpMenu = new javax.swing.JMenu();
        viewMenu = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        fileMenu.setText("File");
        mainMenuBar.add(fileMenu);

        viewMenu.setText("View");
        mainMenuBar.add(viewMenu);
        
        helpMenu.setText("Help");
        mainMenuBar.add(helpMenu);
        
        this.setLocationByPlatform(true);

        setJMenuBar(mainMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                .addContainerGap())
        );
        
        
        JMenuItem temp = new  JMenuItem("About");
        
        temp.addActionListener(new ActionListener(){

            @Override
            public void actionPerformed(ActionEvent e) {
                AboutThisApp about = new AboutThisApp(MainWindow.this, true);
                about.setLocationByPlatform(true);
                about.setVisible(true);
            }
            
        });
        
        helpMenu.add(temp);
        
        pack();
    }
    
}
